package com.gin.no_gay_alliance.database.entity;

import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;

/**
 * 记录IP属地变化历史
 *
 * @author : ginstone
 * @version : v1.0.0
 * @since : 2023/12/26 11:17
 **/
@Entity(indices = {
        @Index(name = "userId", value = {"userId"})
})
public class IpLocationHistory {
    @PrimaryKey(autoGenerate = true)
    public int id;
    /**
     * 用户ID
     */
    public long userId;
    /**
     * IP属地
     */
    public String ipLocation;
    /**
     * 时间戳
     */
    public long timestamp;

    @Ignore
    public IpLocationHistory(long userId, String ipLocation) {
        this.userId = userId;
        this.ipLocation = ipLocation;
        this.timestamp = System.currentTimeMillis() / 1000;
    }

    public IpLocationHistory() {
    }

}
